commit: add logic for .payload-link
authorGiuseppe Scrivano <gscrivan@redhat.com>
Fri, 2 Feb 2018 13:01:08 +0000 (14:01 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 7 Mar 2018 18:28:59 +0000 (18:28 +0000)
commit127d8bb846442c8b2767d12506d10d969b360663
tree87cdd6cc93be6cef8ca4153419b6a51515e640d4
parent118f1f7e40004b079beea0a29f92cd51dc32f81f
commit: add logic for .payload-link

When a new object is added to the repository, create a
$PAYLOAD-SHA256.payload-link symlink file as well.  The target of the
symlink is the checksum of the object that was added the repository.

Whenever we add a new object file, in addition to lookup if the file is
already present with the same checksum we also check if an object with
the same payload is in the repository.

If a file with the same payload is already present in the repository, we
copy it with `glnx_regfile_copy_bytes` that internally attempts to
create a reflink (ioctl (..., FICLONE, ..)) to the target file if the
file system supports it.  This enables to have objects that share the
payload but have a different inode and xattrs.

By default the payload-link-threshold value is G_MAXUINT64 that disables
the feature.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #1443
Approved by: cgwalters
man/ostree.repo-config.xml
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo-private.h
src/libostree/ostree-repo-prune.c
src/libostree/ostree-repo.c
tests/installed/itest-payload-link.sh [new file with mode: 0755]